<?php
class Attribute extends Model {
	public function getAttributeList(){
		$result = $this->dbo->query("SELECT * FROM attribute ORDER BY attribute_id");
		return $result->rows;
	}
	public function addAttribute($name){
		return $this->dbo->query("INSERT INTO attribute (name) VALUES ('".$this->dbo->escape($name)."')");
	}
	public function delAttributeById($id){
		return $this->dbo->query("DELETE FROM attribute WHERE attribute_id = '".(int)$this->dbo->escape($id)."'");
	}
	public function updateAttributeById($id,$name){
		return $this->dbo->query("UPDATE attribute SET name = '".$this->dbo->escape($name)."' WHERE attribute_id = '".(int)$this->dbo->escape($id)."'");
	}
	public function getAttributeById($id){
		$result = $this->dbo->query("SELECT * FROM attribute WHERE attribute_id = '".(int)$this->dbo->escape($id)."'");
		return $result->row;
	}
}
?>